~ chicken-core (chicken-5) /manual/Extension tools


  1[[tags: manual]]
  2[[toc:]]
  3
  4== Extension tools
  5
  6The basic tools to install, uninstall and view "eggs" and the extensions
  7are {{chicken-install}}, {{chicken-uninstall}} and {{chicken-status}}.
  8
  9{{chicken-install}} can be used in two modes: first, as a simple package
 10manager that downloads publicly available eggs (and their dependencies, if
 11necessary) and compiles the contained extensions, installing them on 
 12a user's system.
 13
 14For development of eggs, {{chicken-install}} can also be invoked
 15without arguments, in a directory that contains an egg specification
 16file and the associated source code, building all components and
 17installing them.
 18
 19{{chicken-status}} simply lists installed eggs, the contained extensions,
 20and optionally the files that where installed with a particular egg.
 21
 22Below you will find a description of the available command line options
 23for all three programs. A specification of the egg description file
 24format is [[Egg specification format|here]].
 25
 26=== Security
 27
 28When eggs are downloaded and installed one is executing code
 29from potentially compromised systems. This applies also when
 30{{chicken-install}} executes system tests for required eggs. As
 31the code has been retrieved over the network effectively untrusted
 32code is going to be evaluated. When {{chicken-install}} is run as
 33''root'' the whole system is at the mercy of the build instructions
 34(note that this is also the case every time you install software via
 35{{sudo make install}}, so this is not specific to the CHICKEN
 36egg mechanism).
 37
 38Security-conscious users should never run {{chicken-install}} as root.
 39A simple remedy is to keep the repository inside a user's home
 40directory (see the section "Changing repository location" below).
 41Alternatively obtain write/execute access to the default location of the repository
 42(usually {{/usr/local/lib/chicken}}) to avoid running as
 43root. {{chicken-install}} also provides a {{-sudo}} option to perform
 44the last installation steps as root user, but do building and other
 45.setup script processing as normal. A third solution is to 
 46override {{VARDIR}} when building the system
 47(for example by passing {{"VARDIR=/foo/bar"}} on the make command line,
 48or by modifying {{config.make}}. Eggs will then be installed in
 49{{$(VARDIR)/chicken/8}}.
 50
 51=== Changing the repository location
 52
 53When CHICKEN is installed a repository for eggs is created and initialized
 54in a default location (usually something like {{/usr/local/lib/chicken/9/}}).
 55It is possible to keep an egg repository in another location. This can be
 56configured at build-time by passing {{VARDIR=<directory>}} to {{make(3)}}
 57or by modifying the {{config.make}} configuration file. If you want to
 58override this location after chicken is installed, you can create a
 59repository directory, set the
 60{{CHICKEN_INSTALL_REPOSITORY}} and/or {{CHICKEN_REPOSITORY_PATH}}
 61environment variables to the full path of the new reopsitory and copy all files
 62from the default repository into the new one.
 63
 64Note that your binary version can differ from the one given in 
 65the examples here, if your
 66chicken version is older or newer than the one used in these examples.
 67Check your default location for the correct binary-version number.
 68
 69{{CHICKEN_REPOSITORY_PATH}} is a directory (or a list of directories
 70separated by {{:}}/{{;}}) where eggs are to be
 71loaded from for all chicken-based programs. {{CHICKEN_INSTALL_REPOSITORY}}
 72is the place where eggs will be installed and which the egg-related
 73tools like {{chicken-install}}, {{chicken-uninstall}} and
 74{{chicken-status}} consult and update.
 75
 76Finally, {{CHICKEN_INSTALL_PREFIX}} allows you to override where any
 77installed files should be stored, including extension libraries, programs
 78and data files. Effectively this variable overrides the installation
 79prefix given when building and installing chicken. When installing eggs,
 80the location where dependency extensions and tools are installed will
 81not be automatically found, so setting this variable usually only makes
 82sense when used in combination with {{CHICKEN_REPOSITORY_PATH}}.
 83
 84{{CHICKEN_INSTALL_PREFIX}} is intended for special situations and should be used
 85with care. It is a last-resort utility to customize where build-results are placed.
 86
 87Make sure the paths given in these 
 88environment variables are absolute and not relative.
 89
 90=== Static linking
 91
 92Static linking of extensions and programs is fully supported and
 93should be transparent to the user. Every extension will by
 94default be compiled into a dynamically loadable and a statically
 95linkable entity. By passing {{-static}} on the {{csc}} command-line,
 96eggs that are available in static form will be linked instead of
 97the dynamically loadable version. Use the {{linkage}} egg
 98description property to select in what modes a component should
 99be built.
100
101To identify the necessary object files during linking of 
102extensions, {{csc}}
103creates so-called "link files" and installs them along the
104statically compiled object file in the local egg repository.
105These link files specify what objects should be linked when
106an application is using a static variant of an extension.
107
108
109=== Locations
110
111For experimentation or in-house builds of software it may be
112useful to have private egg repositories in addition to the
113official CHICKEN egg repository. This can be accomplished by
114defining so-called "locations", directories that contain egg
115source-code and description files and which should be scanned
116before trying to retrieve an egg via the network.
117
118The file {{<PREFIX>/share/chicken/setup.defaults}} holds various
119parameters that define where eggs should be downloaded, together
120with more obscure options, and can be used to customize the
121sources where eggs will be retrieved from. Adding a line of 
122the form
123
124{{(location "<PATH>")}}
125
126will add {{<PATH>}} as an additional egg source, where {{<PATH>}}
127should be a directory in the local filesystem that contains
128any number of eggs, one directory for each, including the source code
129and the {{.egg}} files for each egg.
130
131Locations are searched before trying to retrieve from the network.
132Any number of locations may be defined.
133
134
135=== The egg cache
136
137Eggs are downloaded and built in the so called "egg cache", an
138intermediate location used for storing already downloaded source code
139and for providing a temporary location for building the eggs before
140they are installed.
141
142By default the cache is located in the directory
143{{.chicken-install/cache}} in the user's home directory ({{$HOME}} on
144UNIX, or {{%USERPROFILE%}} on Windows. If the respective environment
145variable is not set, then {{/tmp}} or {{/Temp}} is used.
146
147Built extensions and programs remain in the cache, to avoid rebuilding
148already compiled code and multiple downloads of eggs in case the
149installation of an egg fails - the dependencies will be cached after
150the first download and re-download is not needed.
151
152{{chicken-install}} tries to take extreme care to avoid stale binaries,
153but should you be in doubt, simply delete the directory, or run
154{{chicken-install -purge}} to clear the cache or parts of it.
155
156You can override the location of the cache by setting the
157{{CHICKEN_EGG_CACHE}} environment variable.
158
159
160=== Egg installation in detail
161
162==== Retrieval
163
164First the egg names given on the command line (or, if no arguments
165are given, all eggs identified by {{.egg}} files in the current 
166directory, including any in a subdirectory named {{chicken}})
167must be retrieved, either from a local source or from the official
168egg repository. Should the egg exist in the egg cache we check
169whether this cached version is out of date. A cached egg is 
170considered out of date, if a) it is locally available and all cached
171files belonging to the egg do not have newer timestamps than the
172local files, or b) if it is a remotely retrieved egg and no
173newer versions exist on the remote egg server and the last time
174the cache was filled from the remote location is not later than
175one hour. Additionally, if any changes in certain environment
176variables that may influence the compilation of an egg, or if
177the CHICKEN version changed, then retrieval of the egg sources
178is enforced in any case.
179
180If the egg is in the current directory, or in
181a "location" (as described above), the files are copied into
182the cache. If the egg is remotely available, then it is retrieved
183via HTTP from one of the egg servers defined in {{setup.defaults}}.
184
185Once the egg sources are retrieved and stored in the cache,
186their {{.egg}} files are loaded and validated. After this
187any egg dependencies are resolved and located in the cache,
188triggering a recursive retrieval, if necessary.
189
190==== Preparation
191
192Unless the {{-retrieve}} option was given, the eggs intended
193to be built and installed are now scheduled for compilation.
194The egg information from the {{.egg}} files is processed and
195translated into build and install scripts for the current
196platform - if this CHICKEN was configured for cross compilation,
197and no separate host- or target-build was selected, two sets
198of build/install scripts will be generated, one for the host
199system and one for the target.
200
201==== Building and installation
202
203Unless {{-dry-run}} was given on the command-line, the build-
204and install scripts are now executed, ordered by the dependency
205relationships between the full set of eggs that are scheduled
206for compilation. If the {{-test}} option was given and a file named
207{{run.scm}} exists in the {{tests}} subdirectory of the egg
208sources, then this script is executed. Should it terminate with
209an error or a non-zero exit code, the installation is still performed
210and {{chicken-install}} does not abort. Only after all scheduled
211eggs have been installed, {{chicken-install}} will terminate
212with a non-zero exit code.
213
214Note that the build process attempts to minimize re-building
215of already compiled files in the cache, using the {{chicken-do}}
216program. See the manual page for {{chicken-do}} for more details.
217
218From the egg-information in the {{.egg}} file, the set of files
219installed for a particular egg are added to the egg-information
220and stored together with the build-artifacts produced by the
221build scripts.
222
223=== chicken-install reference
224
225Available options:
226
227; {{-h   -help}} : show this message and exit
228; {{-version}} : show version and exit
229; {{-force}} : don't ask, install even if versions don't match
230; {{-k   -keep}} : keep temporary files
231; {{-s   -sudo}} : use external command to elevate privileges when installing or removing files
232; {{-no-install-dependencies}} : do not install dependencies
233; {{-r   -retrieve}} : only retrieve egg into cache directory, don't install (giving {{-r}} more than once implies {{-recursive}})
234; {{-recursive}} : if {{-retrieve}} is given, retrieve also dependencies
235; {{-dry-run}} :  do not build or install, just print the locations of the generated build + install scripts
236; {{-list-versions}} : list available version for an extension (HTTP transport only)
237; {{-n   -no-install}} : do not install, only build the egg.
238; {{-purge}} : remove cached files for given eggs (or purge cache completely)
239; {{-cached}} : install from cache, do not download
240; {{-host}} : when cross-compiling, compile egg for host only
241; {{-target}} : when cross-compiling, compile egg for target only
242; {{-test}} : run included test-cases, if available
243; {{-u   -update-db}} : update export database
244; {{-repository}} : print path to egg repository
245; {{-override FILENAME}} : override versions for installed eggs with information given in {{FILENAME}}, which can be generated by {{-scan}} or by the {{-list}} option of the {{chicken-status}} program
246; {{-from-list FILENAME}} : install eggs given in {{FILENAME}}, in the same format as produced by the {{-list}} option in {{chicken-status}}; this option may be given multiple times
247; {{-v   -verbose}} : be verbose
248; {{-D   -feature NAME}} : defines a build feature, that can be tested using {{cond-expand}} in egg specifications
249; {{ -defaults FILENAME }} :  use {{FILENAME}} as defaults instead of the installed {{setup.defaults}} file
250
251{{chicken-install}} recognizes the {{SUDO}}, {{http_proxy}} and {{proxy_auth}} environment variables, if set.
252
253When running {{chicken-install}} with an argument {{NAME}}, for which
254no associated {{.egg}} file exists, then it will try to download the
255extension via HTTP from the CHICKEN code repository at
256[[http://code.call-cc.org/svn/chicken-eggs/]]. Extensions that are
257required to compile and/or use the requested extension are downloaded
258and installed automatically.
259
260
261=== chicken-uninstall reference
262
263; {{-h   -help}} : show usage information and exit
264; {{-version}} : show version and exit
265; {{-force}} : don't ask, delete whatever matches
266; {{-match}} : treat egg-names as glob patterns
267; {{-s   -sudo}} : use external command to elevate privileges for deleting files
268; {{-host}} : when cross-compiling, remove eggs for host system only
269; {{-target}} : when cross-compiling, remove eggs for target system only
270
271
272=== chicken-status reference
273
274; {{-h   -help}} : show usage information and exit
275; {{-version}} : show version and exit
276; {{-f   -files}} : list installed files
277; {{-match}} : treat egg-names as glob patterns
278; {{-host}} : when cross-compiling, show eggs for host system only
279; {{-target}} : when cross-compiling, show eggs for target system only
280; {{-list}} : list installed egg version in format suitable for {{chicken-install -override}} or {{-from-list}}
281; {{-c   -components}} : list installed components
282; {{-cached}} : list eggs available in the cache directory
283
284
285---
286
287Previous: [[Extensions]]
288
289Next: [[Egg specification format]]
Trap